#! /bin/bash
#SQOOP_HOME=/opt/cloudera/parcels/CDH-6.2.1-1.cdh6.2.1.p0.1425774/bin/sqoop
SQOOP_HOME=/usr/bin/sqoop
if [[ $1 == "" ]];then
 TD_DATE=`date -d '1 days ago' "+%Y-%m-%d"` 
else
 TD_DATE=$1
fi
/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/teach' \
--username root \
--password 123456 \
--query "select *, '${TD_DATE}' as dt from tbh_student_signin_record where 1=1 \$CONDITIONS" \
--hcatalog-database itcast_ods \
--hcatalog-table student_signin_ods \
-m 1